from launch import LaunchDescription
from launch_ros.actions import LoadComposableNodes, Node
from launch_ros.descriptions import ComposableNode

def generate_launch_description():
    log_level = 'info'

    return LaunchDescription([
        Node(
            package='rclcpp_components',
            executable='component_container',
            name='pnpsolve', 
            output='screen',
            ros_arguments=['--log-level', log_level]
        ),
        LoadComposableNodes(
            target_container='pnpsolve', 
            composable_node_descriptions=[
                ComposableNode(
                    package='pnpsolve',
                    plugin='palomino::pnpsolve',
                    name='pnpsolve_node',
                    extra_arguments=[{'use_intra_process_comms': True}],
                ),
                ComposableNode(
                    package='v4l2_camera',
                    plugin='v4l2_camera::V4L2Camera',
                    name='v4l2_camera',
                    extra_arguments=[{'use_intra_process_comms': True}],
                ),
            ],
        ),
    ])